package org.worthydots.access.jpa.dao;

public class DAOFactory {

	private static DAOFactory daoFactory;
	private static StationDAO stationDAO;
	private static TrainDAO trainDAO;
	private static TrainScheduleDAO trainScheduleDAO;
	private static StationRouteDAO stationRouteDAO;

	private DAOFactory() {
	}

	public static DAOFactory getInstance() {
		if (daoFactory == null)
			daoFactory = new DAOFactory();
		return daoFactory;
	}

	public StationDAO getStationDAO() {
		if (stationDAO == null)
			stationDAO = new StationDAOImpl();
		return stationDAO;
	}

	public TrainDAO getTrainDAO() {
		if (trainDAO == null)
			trainDAO = new TrainDAOImpl();
		return trainDAO;
	}

	public TrainScheduleDAO getTrainScheduleDAO() {
		if (trainScheduleDAO == null)
			trainScheduleDAO = new TrainScheduleDAOImpl();
		return trainScheduleDAO;
	}

	public StationRouteDAO getStationRouteDAO() {
		if (stationRouteDAO == null)
			stationRouteDAO = new StationRouteDAOImpl();
		return stationRouteDAO;
	}
}
